﻿<!-- 
// (c) Copyright Webber-Cross Software Ltd.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
-->

<Window xmlns:local="clr-namespace:WebberCross.BdcModelBuilder"
        xmlns:vw="clr-namespace:WebberCross.BdcModelBuilder.TabControls"  x:Class="WebberCross.BdcModelBuilder.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="SharePoint 2010 Bdc Model Builder" Height="500" Width="600" Icon="/WebberCross.BdcModelBuilder;component/gear.ico">
    
    <Window.InputBindings>
        <KeyBinding Key="S" Modifiers="Control" Command="{Binding SaveCommand}"/>
        <KeyBinding Key="E" Modifiers="Control" Command="{Binding EditCommand}"/>
        <KeyBinding Key="R" Modifiers="Control" Command="{Binding RefreshCommand}"/>
        <KeyBinding Key="W" Modifiers="Control" Command="{Binding WriteCommand}"/>
        <KeyBinding Key="L" Modifiers="Control" Command="{Binding WriteAllCommand}"/>
    </Window.InputBindings>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="30" />
            <RowDefinition Height="*" />
            <RowDefinition Height="30" />
        </Grid.RowDefinitions>
        
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        
        <Menu VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Grid.Row="0">
            <MenuItem Header="File">
                <MenuItem Header="New" Command="{Binding NewFileCommand}" />
                <MenuItem Header="Open" Command="{Binding OpenCommand}" />
                <MenuItem Header="Save" Command="{Binding SaveCommand}" />
                <MenuItem Header="Save As" Command="{Binding SaveAsCommand}" />
                <MenuItem Header="Exit" Command="{Binding ExitCommand}" />
            </MenuItem>
            <MenuItem Header="Edit">
                <MenuItem Header="Undo" Command="ApplicationCommands.Undo" />
                <MenuItem Header="Redo" Command="ApplicationCommands.Redo" />
                <Separator />
                <MenuItem Header="Cut" Command="ApplicationCommands.Cut" />
                <MenuItem Header="Copy" Command="ApplicationCommands.Copy" />
                <MenuItem Header="Paste" Command="ApplicationCommands.Paste" />
            </MenuItem>
            <MenuItem Header="Model">
                <MenuItem Header="New" Command="{Binding NewModelCommand}" />
                <MenuItem Header="Edit" Command="{Binding EditCommand}" />
                <MenuItem Header="Write" Command="{Binding WriteCommand}" />
                <MenuItem Header="Write All" Command="{Binding WriteAllCommand}" />
                <MenuItem Header="Delete" Command="{Binding DeleteCommand}" />
            </MenuItem>
            <MenuItem Header="Preview">
                <MenuItem Header="Refresh" Command="{Binding RefreshCommand}" />
            </MenuItem>
        </Menu>

        <TabControl Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
            <TabItem Header="Models">
                <vw:ModelsTab x:Name="modelsTabControl" />
            </TabItem>
            <TabItem Header="Entity">
                <vw:EntityDetailsTab x:Name="entityTabControl" />
            </TabItem>
            <TabItem Header="Methods">
                <vw:MethodDetailsTab x:Name="methodsTabControl" />
            </TabItem>
            <TabItem Header="Data Source">
                <vw:DataSourceTab x:Name="dataSourceTabControl" />
            </TabItem>
            <TabItem Header="Entity Preview">
                <ListBox VerticalAlignment="Stretch" HorizontalAlignment="Stretch" ItemsSource="{Binding Path=EntityCode}" />
            </TabItem>
            <TabItem Header="BDCM Preview">
                <ListBox VerticalAlignment="Stretch" HorizontalAlignment="Stretch" ItemsSource="{Binding Path=BDCMCode}" />
            </TabItem>
            <TabItem Header="Service Preview">
                <ListBox VerticalAlignment="Stretch" HorizontalAlignment="Stretch" ItemsSource="{Binding Path=ServiceCode}" />
            </TabItem>
        </TabControl>
        
        <StatusBar x:Name="statusBar" Grid.Row="2">
            <StatusBarItem>
                <TextBlock x:Name="label" Text="Current Model: " />
            </StatusBarItem>
            <StatusBarItem>
                <TextBlock x:Name="sslModel" Text="{Binding Path=ModelContainer.CurrentModel.Name}" />
            </StatusBarItem>
        </StatusBar>
        
    </Grid>
</Window>
